﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using BasicDataManagement;

namespace Cashier
{
    /// <summary>
    /// AddSellOffItemWindow.xaml 的交互逻辑
    /// </summary>
    public partial class AddSellOffItemWindow : Window
    {
        BasicDataManagement.IOpertation op;
        List<string> dishNameList;
        public string selectedDishName;

        public AddSellOffItemWindow()
        {
            InitializeComponent();
            op = BasicDataManagement.OperationFactory.Create();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            dishNameList = new List<string>();
            dishNameList.AddRange(op.LoadFixedDishItemName());
            //dishNameList.AddRange(op.LoadReplaceableDishItemName());
            dishNameList.AddRange(op.LoadOptionItemName());
            dishCombo.ItemsSource = new ObservableCollection<string>(dishNameList);
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            if (dishCombo.Text.Equals(""))
            {
                MessageBox.Show("请选择一款产品");
                return;
            }
            selectedDishName = dishCombo.Text;
            this.DialogResult = true;
            this.Close();
        }

        private void btnCancel_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = false;
            this.Close();
        }
    }
}
